<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>

  <div id="app">
    app
  </div>

  <script src="../react-js/react.development.js" crossorigin></script>
  <script src="../react-js/react-dom.development.js" crossorigin></script>
  <script src="../react-js/babel.min.js"></script>
  
  <script type="text/babel">
    //声明式编程：
    
    //1.
    let message = 'Hello World';

    //3.
    function btnClick() {
      message = 'Hello React'
      //6.
      render()
    }

    //4.
    function render() {
      //2.
      ReactDOM.render(
        <div>
          <h2>{ message }</h2>
          <p>这是一段描述........</p>
          <button onClick={ btnClick }>按钮</button>
        </div>,
        document.getElementById('app')
      )
    }

    //5.
    render();
    
  </script>
</body>
</html>